package com.leave.mos.controller.find;

import com.leave.mos.entity.Order;
import com.leave.mos.entity.User;
import com.leave.mos.service.find.MongodbSelectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName MongodbSaveController
 * @Description TODO
 * @Author lh
 * @Date 2021/7/7 17:42
 * @Version 1.0
 **/

@RestController
@RequestMapping("select")
public class MongodbSelectController {

    @Autowired
    private MongodbSelectService mongodbSelectService;

    @RequestMapping("/findClass")
    List<User> findClass(User user){
        return mongodbSelectService.findClass(user);
    }

    @RequestMapping("findTable")
    List<User> findTable(User user){
       return mongodbSelectService.findTable(user);
    }

    @GetMapping("findAll")
    List<Order> findTable(){
        return mongodbSelectService.findAll();
    }

    @GetMapping("findAllTable")
    List<Order> findAllTable(){
        return mongodbSelectService.findAllTable();
    }

    @GetMapping("findById")
    Order findById(String id){
        return mongodbSelectService.findById(id);
    }

    @GetMapping("findAllAndRemove")
    List<Order> findAllAndRemove(String id){
        return mongodbSelectService.findAllAndRemove();
    }

}
